home *** CD-ROM | disk | FTP | other *** search
/ Level 2005 Christmas (DVD) / Level_2005-XMAS_134_DVD_Knightshift.iso / Demos / Ski Racing 2006 / setup1.cab / DataCommonShadersDX9MatrixPaletteSkinning.vsh < prev    next >
Encoding:
Text File  |  2005-11-03  |  1.5 KB  |  69 lines

  1. vs.1.1
  2.  
  3. ;
  4. ; v0 = position
  5. ; v1 = weights
  6. ; v2 = matrix indices
  7. ; v3 = normals
  8. ; v7 = texture coords
  9. ;
  10. ; c0-3 = SkinWorldViewProj
  11. ; c4   = color
  12. ; c5   = constants - 1,1,1,255.01
  13. ; c10+ = bone matrices
  14.  
  15. dcl_position        v0
  16. dcl_blendweight     v1
  17. dcl_blendindices    v2
  18. dcl_normal          v3
  19. dcl_texcoord        v7
  20.  
  21. ; Determine the 4th weight
  22. mov     r0.xyz, v1.xyz            ; r0.xyz = w0,w1,w2
  23. dp3     r0.w, v1.xyz, c5.xxxx    ; r0.w = w0 + w1 + w2
  24. add     r0.w, -r0.w, c5.x       ; r0.2 = 1 - (w0 + w1 + w2) = w3
  25.  
  26. ; Need to offset the values
  27. ;mul     r1, v2.xyzw, c5.wwww    ; r1 = indices w/ offset
  28. mul     r1, v2.zyxw, c5.wwww     ; r1 = indices w/ offset (D3DCOLOR Version)
  29.  
  30. ; First bone
  31. mov        a0.x, r1.x
  32. mul        r2, r0.x, c[a0.x+0+10]
  33. mul         r3, r0.x, c[a0.x+1+10]
  34. mul        r4, r0.x, c[a0.x+2+10]
  35.  
  36. ; Second bone
  37. mov        a0.x, r1.y
  38. mad        r2, r0.y, c[a0.x+0+10], r2
  39. mad        r3, r0.y, c[a0.x+1+10], r3
  40. mad        r4, r0.y, c[a0.x+2+10], r4
  41.  
  42. ; Third bone
  43. mov        a0.x, r1.z
  44. mad        r2, r0.z, c[a0.x+0+10], r2
  45. mad        r3, r0.z, c[a0.x+1+10], r3
  46. mad        r4, r0.z, c[a0.x+2+10], r4
  47.  
  48. ; Fourth bone
  49. mov        a0.x, r1.w
  50. mad        r2, r0.w, c[a0.x+0+10], r2
  51. mad        r3, r0.w, c[a0.x+1+10], r3
  52. mad        r4, r0.w, c[a0.x+2+10], r4
  53.  
  54. ; Transform weighted position
  55. dp4        r5.x, v0, r2
  56. dp4        r5.y, v0, r3
  57. dp4        r5.z, v0, r4
  58. mov        r5.w, c5.x
  59.  
  60. ; World, view, projection
  61. ;dp4        oPos.x, r5, c0
  62. ;dp4        oPos.y, r5, c1
  63. ;dp4        oPos.z, r5, c2
  64. ;dp4        oPos.w, r5, c3
  65. m4x4    oPos, r5, c0
  66.  
  67. ; Texture coordinates
  68. mov        oT0.xy, v7.xy
  69.